<?php
/**
 * Digg pagination style
 * 
 * @preview  « Previous  1 2 … 5 6 7 8 9 10 11 12 13 14 … 25 26  Next »
 */
?>
<p class="pagination">

	<?php if ($this->previous_page): ?>
		<a href="<?php echo $this->url(array('page' => $this->previous_page)); ?>">&laquo;&nbsp;vorige</a>
	<?php else: ?>
		&laquo;&nbsp;vorige
	<?php endif ?>


	<?php if ($this->total_pages < 13): /* « Previous  1 2 3 4 5 6 7 8 9 10 11 12  Next » */ ?>

		<?php for ($i = 1; $i <= $this->total_pages; $i++): ?>
			<?php if ($i == $this->current_page): ?>
				<strong><?php echo $i ?></strong>
			<?php else: ?>
				<a href="<?php echo $this->url(array('page' => $i)); ?>"><?php echo $i ?></a>
			<?php endif ?>
		<?php endfor ?>

	<?php elseif ($this->current_page < 9): /* « Previous  1 2 3 4 5 6 7 8 9 10 … 25 26  Next » */ ?>

		<?php for ($i = 1; $i <= 10; $i++): ?>
			<?php if ($i == $this->current_page): ?>
				<strong><?php echo $i ?></strong>
			<?php else: ?>
				<a href="<?php echo $this->url(array('page' => $i)); ?>"><?php echo $i ?></a>
			<?php endif ?>
		<?php endfor ?>

		&hellip;
		<a href="<?php echo $this->url(array('page' => $this->total_pages - 1)); ?>"><?php echo $this->total_pages - 1 ?></a>
		<a href="<?php echo $this->url(array('page' =>  $this->total_pages )); ?>"><?php echo $this->total_pages ?></a>

	<?php elseif ($this->current_page > $this->total_pages - 8): /* « Previous  1 2 … 17 18 19 20 21 22 23 24 25 26  Next » */ ?>

		<a href="<?php echo $this->url(array('page' => 1)); ?>">1</a>
		<a href="<?php echo $this->url(array('page' => 2)); ?>">2</a>
		&hellip;

		<?php for ($i = $this->total_pages - 9; $i <= $this->total_pages; $i++): ?>
			<?php if ($i == $this->current_page): ?>
				<strong><?php echo $i ?></strong>
			<?php else: ?>
				<a href="<?php echo $this->url(array('page' => $i)); ?>"><?php echo $i ?></a>
			<?php endif ?>
		<?php endfor ?>

	<?php else: /* « Previous  1 2 … 5 6 7 8 9 10 11 12 13 14 … 25 26  Next » */ ?>

		<a href="<?php echo $this->url(array('page' => 1)); ?>">1</a>
		<a href="<?php echo $this->url(array('page' => 2)); ?>">2</a>
		&hellip;

		<?php for ($i = $this->current_page - 5; $i <= $this->current_page + 5; $i++): ?>
			<?php if ($i == $this->current_page): ?>
				<strong><?php echo $i ?></strong>
			<?php else: ?>
				<a href="<?php echo $this->url(array('page' => $i)); ?>"><?php echo $i ?></a>
			<?php endif ?>
		<?php endfor ?>

		&hellip;
		<a href="<?php echo $this->url(array('page' => $this->total_pages - 1)); ?>"><?php echo $this->total_pages - 1 ?></a>
		<a href="<?php echo $this->url(array('page' => $this->total_pages )); ?>"><?php echo $this->total_pages ?></a>

	<?php endif ?>


	<?php if ($this->next_page): ?>
		<a href="<?php echo $this->url(array('page' => $this->next_page)); ?>">volgende&nbsp;&raquo;</a>
	<?php else: ?>
		volgende&nbsp;&raquo;
	<?php endif ?>

</p>